﻿using System;
using System.Collections.Generic;
using System.Data;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class control_tour_ListTourHot : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

        }
    }
    protected string GetListTourHot()
    {
       string htmlCode = "";
       DataTable list =
           DataAccess.ExeSQLToDataTable("select top(6)* from dev_news where checktour=1 and status = 1 order by idnews desc");
       if (list.Rows.Count > 0)
       {
           foreach (DataRow dr in list.Rows)
           {
               htmlCode += @" <div class='item'>
                                <a href='chitiettourdulich.aspx?id=" + dr["idnews"] + @"'>
                                    <img src='style/css/img/hot.gif' />
                                    <a  href='chitiettourdulich.aspx?id=" + dr["idnews"] + @"' class='thoigiansk'>" + (dr["thoigian"] == null || dr["thoigian"] == "" ? "" : LoadInfoThoigian(Convert.ToInt64(dr["thoigian"]))) + ":" + @"</a>
                                    <a  href='chitiettourdulich.aspx?id=" + dr["idnews"] + @"' class='tensk'>" + ITNLip.CatChuoi(dr["title"].ToString(), 20) + @"</a>
                                </a>
                            </div>";
           }
       }
        return htmlCode;
    }
    protected string LoadInfoThoigian(long id)
    {
        string result = "";
         DataTable list =
            DataAccess.ExeSQLToDataTable("select Name from Ngay where IdDuLich="+id+"");
        if (list.Rows.Count>0)
        {
            result=  list.Rows[0][0].ToString();
        }
        return result;
    }
}